<script>
    $(function() {
        $("a").button();
        $("a").click(function() { return true; });
    });
</script>
<div style="width: 100%;height: 100%;background-color: #222222" align="center">

<div style="width: 80%;height: 100%;background-color:#eeeeee" align="center" class="ui-widget ui-corner-all">
  <div style="width: 100%;padding: 10px" align="left"><a href="<?php echo url::base()?>/admin/main" class="ui-button ui-widget ui-state-default ui-corner-all">กลับสู่หน้าหลัก</a></div>
    <br>
    <table width="700" style="background-color: white;border: 1px solid black" cellspacing="0" cellpadding="3">
        <thead><tr style="background-color: navy;color: white"><td colspan="8" align="center">รายชื่อคนไข้ทั้งหมด</td></tr></thead>
                <tbody>
                    <tr style="background-color: teal;color: white">
                        <td align="center">ชื่อ</td><td align="center">นามสกุล</td><td align="center">เพศ</td><td align="center">วันเดือนปีเกิด</td><td align="center">เบอร์โทรศัพท์</td><td>แก้ไข</td><td>ลบ</td>
                    </tr>
                    <?php
                    foreach($patient_list as $item) {
                        echo "<tr>";
                        echo "<td>".$item['p_fname']."</td>";
                        echo "<td>".$item['p_lname']."</td>";

                        if($item['p_sex']==1)
                            $sex =  "ชาย";
                        else
                            $sex = "หญิง";

                        echo "<td>".$sex."</td>";
                        echo "<td>".$item['p_bday']."</td>";
                        echo "<td>".$item['p_phone']."</td>";
                        echo "<td>".html::anchor("admin/patient_edit?p_id=".$item['p_id'],html::image("assets/icon/pencil_48.png",array('width'=>'24','height','24','alt'=>'edit','border'=>'0'))) ."</td>";
                        echo "<td>".html::anchor("admin/patient_del?p_id=".$item['p_id'],html::image("assets/icon/cross_48.png",array('width'=>'24','height','24','alt'=>'del','border'=>'0'))) ."</td>";
                        echo "</tr>";
                    }
                    ?>
                </tbody>
            </table>
        <br>       
    </div>
</div>
